<?php
    include_once('../../MooDom.php');
    
    $document = new MooDom('layout.html');
    $body = $document->body;
    $tbody = $body->getElementById('menuitems');
    $row_un = $tbody->getElement('//*[@var="unselected"]');
    $row_sel = $tbody->getElement('//*[@var="selected"]');
    $tbody->clear();
    
    $entries = array(
        array('href' => '', 'title' => 'First', 'description' => '/dev/null/12'),
        array('href' => '', 'title' => 'Second', 'description' => '/dev/foo/2345'),
        array('href' => '', 'title' => 'Third', 'description' => '/dev/hump/3444'),
        array('href' => '', 'title' => 'Forth', 'description' => '/tmp/run/rawr'),
        array('href' => '', 'title' => 'Fith', 'description' => '/usr/bin/apache')
    );
    
    foreach($entries as $entry) {
        $row = $row_un->copy();
        $row->getElement('//*[@var="title"]')->set('text', $entry['title']);
        $row->getElement('//*[@var="description"]')->set('text', $entry['description']);
        $row->inject($tbody);
    }
    
    echo $document;
?>
